package com.polytech.utils;

import com.polytech.business.CarsManager;
import com.polytech.business.ClientManager;
import com.polytech.business.ConnexionManager;
import com.polytech.business.DefaultCarsManager;
import com.polytech.business.DefaultClientManager;
import com.polytech.business.DefaultConnexionManager;
import com.polytech.business.DefaultReservationManager;
import com.polytech.business.DefaultSearchEngine;
import com.polytech.business.ReservationManager;
import com.polytech.business.SearchEngine;
import com.polytech.dao.BookingDao;
import com.polytech.dao.BrandDao;
import com.polytech.dao.CarDao;
import com.polytech.dao.CategoryDao;
import com.polytech.dao.ClientDao;
import com.polytech.dao.ColorDao;
import com.polytech.dao.MemoryBookingDao;
import com.polytech.dao.MemoryBrandDao;
import com.polytech.dao.MemoryCarDao;
import com.polytech.dao.MemoryCategoryDao;
import com.polytech.dao.MemoryClientDao;
import com.polytech.dao.MemoryColorDao;
import com.polytech.dao.MemoryModelDao;
import com.polytech.dao.ModelDao;
import com.polytech.dao.hibernate.BookingDaoHibernate;
import com.polytech.dao.hibernate.BrandDaoHibernate;
import com.polytech.dao.hibernate.CarDaoHibernate;
import com.polytech.dao.hibernate.CategoryDaoHibernate;
import com.polytech.dao.hibernate.ClientDaoHibernate;
import com.polytech.dao.hibernate.ColorDaoHibernate;
import com.polytech.dao.hibernate.ModelDaoHibernate;

public class BusinessFactory {

	private static ConnexionManager connexionManager;
	private static CarsManager carsManager;
	private static SearchEngine searchEngine;
	private static ReservationManager reservationManager;
	private static DefaultClientManager clientManager;

	static
	{
		BookingDao bookingDao=new BookingDaoHibernate();
		ClientDao clientDao=new ClientDaoHibernate();
		BrandDao brandDao =new BrandDaoHibernate();
		CategoryDao categoryDao=new CategoryDaoHibernate();
		ModelDao modelDao=new ModelDaoHibernate();
		CarDao carDao=new CarDaoHibernate();
		ColorDao colorDao=new ColorDaoHibernate();
		connexionManager=new DefaultConnexionManager();
		carsManager=new DefaultCarsManager();
		searchEngine=new DefaultSearchEngine();
		reservationManager=new DefaultReservationManager();
		 clientManager=new DefaultClientManager();
		
		((DefaultConnexionManager)connexionManager).setClientDao(clientDao);
		((DefaultReservationManager)reservationManager).setBookingDao(bookingDao);
		((DefaultCarsManager)carsManager).setCarDao(carDao);
		((DefaultCarsManager)carsManager).setModelDao(modelDao);
		((DefaultCarsManager)carsManager).setCategoryDao(categoryDao);
		((DefaultCarsManager)carsManager).setBrandDao(brandDao);
		((DefaultClientManager)clientManager).setClientDao(clientDao);
		((DefaultCarsManager)carsManager).setColorDao(colorDao);

	}

	public static ConnexionManager getConnexionManager() {
		return connexionManager;
	}

	public static CarsManager getCarsManager() {
		return carsManager;
	}

	public static SearchEngine getSearchEngine() {
		return searchEngine;
	}

	public static ReservationManager getReservationManager() {
		return reservationManager;
	}

	public static DefaultClientManager getClientManager() {
		return clientManager;
	}
	
	
}
